package com.yifeng.repo.tookit.oss.model;

import java.util.Date;

/**
 * Oss html form signature, for html upload directly
 */
public class Signature {
    // oss upload params
    private String accessId;
    private String signature;
    private String policy;
    private String key;

    // files
    private String host;
    private String url;
    private String expire;

    /**
     * obs新增字段：类型
     */
    private String mode;
    /**
     * obs新增字段：文件metadata 头部声明
     */
    private String contentType;
    /**
     * obs新增字段：obs文件访问权限控制
     */
    private String xObsAcl;

    @Override
    public String toString() {
        return accessId + "@" + policy + "@" + signature + "@" + host + key + "@" + new Date(Long.parseLong(expire));
    }

    public String getAccessId() {
        return accessId;
    }

    public void setAccessId(String accessId) {
        this.accessId = accessId;
    }

    public String getPolicy() {
        return policy;
    }

    public void setPolicy(String policy) {
        this.policy = policy;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getHost() {
        return host;
    }

    public void setHost(String host) {
        this.host = host;
    }

    public String getUrl() {
        return url == null ? host + key : url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getExpire() {
        return expire;
    }

    public void setExpire(String expire) {
        this.expire = expire;
    }

    public String getMode() {
        return mode;
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public String getContentType() {
        return contentType;
    }

    public void setContentType(String contentType) {
        this.contentType = contentType;
    }

    public String getxObsAcl() {
        return xObsAcl;
    }

    public void setxObsAcl(String xObsAcl) {
        this.xObsAcl = xObsAcl;
    }
}
